﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ch05
{
    class Class7
    {
        static void Main(string[] args)
        {
            int[,] nums = new int[3,4];

            nums[0, 0] = 1;
            nums[0, 1] = 2;
            nums[0, 2] = 3;
            nums[0, 3] = 4;
            nums[1, 0] = 5;
            nums[1, 1] = 6;
            nums[1, 2] = 7;
            nums[1, 3] = 8;

            /*
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    Console.Write(nums[i, j] + "\t");
                }
                Console.WriteLine();
            }
            */

            
            for (int i = 0; i < nums.GetLength(0); i++)
            {
                for (int j = 0; j < nums.GetLength(1); j++)
                {
                    Console.Write(nums[i, j] + "\t");
                }
                Console.WriteLine();
            }


            /*
            //Length属性可以获取数组中所有元素的个数
            Console.WriteLine(nums.Length);

            //GetLength方法可以获取指定维中的元素的个数
            Console.WriteLine(nums.GetLength(0));
            Console.WriteLine(nums.GetLength(1));
            */


        }
    }
}
